package com.ihr360.payroll.service.alps.profile;

/**
 * Created by Eric on 2018/4/12/012.
 */

import com.google.common.collect.ImmutableList;
import com.ihr360.alps.PropertyDescriptor;
import com.ihr360.alps.PropertyType;
import com.ihr360.alps.ServiceDescriptor;
import com.ihr360.alps.api.ServiceProvider;
import com.ihr360.attendance.AttendanceReportFixedPart;
import com.ihr360.payroll.service.alps.profile.provider.AttendanceParamProvider;
import com.ihr360.payroll.service.alps.profile.provider.ProfileParamProvider;

import java.util.List;

/**
 * 考勤字段定义
 */
public class AttendanceServiceProfile extends BaseServiceProfile {
    public static final AttendanceServiceProfile paidDays = new AttendanceServiceProfile(0, "月计薪天数", AttendanceReportFixedPart.Field.PAID_DAYS, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    //public static final AttendanceServiceProfile monthPaidDays = new AttendanceServiceProfile(1, "月计薪天数", AttendanceReportFixedPart.Field.MONTH_PAID_DAYS, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile supposedWorkingDays = new AttendanceServiceProfile(2, "应出勤天数", AttendanceReportFixedPart.Field.SUPPOSED_WORKING_DAYS, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile workingDays = new AttendanceServiceProfile(3, "实际出勤天数", AttendanceReportFixedPart.Field.WORKING_DAYS, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile absenceFromDutyDays = new AttendanceServiceProfile(3, "缺勤次数", AttendanceReportFixedPart.Field.ABSENCE_FROM_DUTY_DAYS, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile othours150 = new AttendanceServiceProfile(4, "平日加班小时", AttendanceReportFixedPart.Field.OT_HOURS_150, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile othours200 = new AttendanceServiceProfile(5, "周末加班小时", AttendanceReportFixedPart.Field.OT_HOURS_200, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile othours300 = new AttendanceServiceProfile(6, "节假日加班小时", AttendanceReportFixedPart.Field.OT_HOURS_300, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile workingDayOvertimeCal = new AttendanceServiceProfile(7, "工作日加班累计", AttendanceReportFixedPart.Field.WORKINGDAY_OVERTIME_CAL, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile restDayOvertimeCal = new AttendanceServiceProfile(8, "休息日加班累计", AttendanceReportFixedPart.Field.RESTDAY_OVERTIME_CAL, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile holidayOvertimeCal = new AttendanceServiceProfile(9, "节假日加班累计", AttendanceReportFixedPart.Field.HOLIDAY_OVERTIME_CAL, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile sickleavedays = new AttendanceServiceProfile(10, "病假时长", AttendanceReportFixedPart.Field.SICK_LEAVE_COUNT, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    //public static final AttendanceServiceProfile paysickleavedays = new AttendanceServiceProfile(11, "全薪病假时长", AttendanceReportFixedPart.Field.PAY_SICK_LEAVE_COUNT, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile unpaidleavedays = new AttendanceServiceProfile(12, "事假时长", AttendanceReportFixedPart.Field.UNPAID_LEAVE_COUNT, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile maternitydays = new AttendanceServiceProfile(13, "产假时长", AttendanceReportFixedPart.Field.MATERNITY_COUNT, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile syntheticaladjust = new AttendanceServiceProfile(14, "工时调整-综合", AttendanceReportFixedPart.Field.SYNTHETICAL_ADJUST, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile syntheticalothours300 = new AttendanceServiceProfile(15, "节假日加班小时-综合", AttendanceReportFixedPart.Field.SYNTHETICAL_OTHOURS_300, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile syntheticalworkhourmonth = new AttendanceServiceProfile(16, "月工作日工时-综合", AttendanceReportFixedPart.Field.SYNTHETICAL_WORKHOURMONTH, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile syntheticalworkhourquarter = new AttendanceServiceProfile(17, "季工作日工时-综合", AttendanceReportFixedPart.Field.SYNTHETICAL_WORKHOURQUARTER, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile syntheticalworkhouryear = new AttendanceServiceProfile(18, "年工作日工时-综合", AttendanceReportFixedPart.Field.SYNTHETICAL_WORKHOURYEAR, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile annualleavetime = new AttendanceServiceProfile(19, "年假时长", AttendanceReportFixedPart.Field.ANNUAL_LEAVETIME, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile resthours = new AttendanceServiceProfile(20, "调休时长", AttendanceReportFixedPart.Field.REST_HOURS, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile latearrivals = new AttendanceServiceProfile(21, "迟到次数", AttendanceReportFixedPart.Field.LATE_ARRIVALS, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile returnearly = new AttendanceServiceProfile(22, "早退次数", AttendanceReportFixedPart.Field.RETURN_EARLY, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile signinmiss = new AttendanceServiceProfile(23, "签到遗漏次数", AttendanceReportFixedPart.Field.SIGN_IN_MISS, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile signoutmiss = new AttendanceServiceProfile(24, "签退遗漏次数", AttendanceReportFixedPart.Field.SIGN_OUT_MISS, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile lateminutes = new AttendanceServiceProfile(25, "累计迟到分钟数", AttendanceReportFixedPart.Field.LATE_MINUTES, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile earlyminutes = new AttendanceServiceProfile(26, "累计早退分钟数", AttendanceReportFixedPart.Field.EARLY_MINUTES, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    //public static final AttendanceServiceProfile absencefromduty = new AttendanceServiceProfile(27, "缺勤次数", AttendanceReportFixedPart.Field.ABSENCE_FROM_DUTY, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);
    public static final AttendanceServiceProfile nonWorkingDays = new AttendanceServiceProfile(28, "非在职计薪天数", AttendanceReportFixedPart.Field.NON_WORKING_DAYS, BaseServiceProfile.DEFAULT_VAL.FIXED_BASE);


    AttendanceServiceProfile(int index, String name, String code, double defaultValue) {
        super(index, name, code, defaultValue);
    }

    public static ServiceDescriptor serviceDescriptor() {
        List<PropertyDescriptor> propertyDescriptors = ImmutableList
                .of(
                        PropertyDescriptor.builder()
                                .id(paidDays.getCode())
                                .name(paidDays.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(supposedWorkingDays.getCode())
                                .name(supposedWorkingDays.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(workingDays.getCode())
                                .name(workingDays.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(absenceFromDutyDays.getCode())
                                .name(absenceFromDutyDays.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(othours150.getCode())
                                .name(othours150.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(othours200.getCode())
                                .name(othours200.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(othours300.getCode())
                                .name(othours300.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(workingDayOvertimeCal.getCode())
                                .name(workingDayOvertimeCal.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(restDayOvertimeCal.getCode())
                                .name(restDayOvertimeCal.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(holidayOvertimeCal.getCode())
                                .name(holidayOvertimeCal.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(sickleavedays.getCode())
                                .name(sickleavedays.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        /*PropertyDescriptor.builder()
                                .id(paysickleavedays.getCode())
                                .name(paysickleavedays.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),*/
                        PropertyDescriptor.builder()
                                .id(unpaidleavedays.getCode())
                                .name(unpaidleavedays.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(maternitydays.getCode())
                                .name(maternitydays.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(syntheticaladjust.getCode())
                                .name(syntheticaladjust.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(syntheticalothours300.getCode())
                                .name(syntheticalothours300.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(syntheticalworkhourmonth.getCode())
                                .name(syntheticalworkhourmonth.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(syntheticalworkhourquarter.getCode())
                                .name(syntheticalworkhourquarter.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(syntheticalworkhouryear.getCode())
                                .name(syntheticalworkhouryear.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(annualleavetime.getCode())
                                .name(annualleavetime.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(resthours.getCode())
                                .name(resthours.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(latearrivals.getCode())
                                .name(latearrivals.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(returnearly.getCode())
                                .name(returnearly.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(signinmiss.getCode())
                                .name(signinmiss.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(signoutmiss.getCode())
                                .name(signoutmiss.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(lateminutes.getCode())
                                .name(lateminutes.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        PropertyDescriptor.builder()
                                .id(earlyminutes.getCode())
                                .name(earlyminutes.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),
                        /*PropertyDescriptor.builder()
                                .id(absencefromduty.getCode())
                                .name(absencefromduty.getName())
                                .type(PropertyType.DOUBLE)
                                .build(),*/
                        PropertyDescriptor.builder()
                                .id(nonWorkingDays.getCode())
                                .name(nonWorkingDays.getName())
                                .type(PropertyType.DOUBLE)
                                .build()
                );
        return ServiceDescriptor.builder()
                .serviceId(ServiceProvider.SERVICE_ID.ATTENDANCE_MONTHLY_REPORT)
                .name("考勤")
                .path("/alps/" + ServiceProvider.SERVICE_ID.ATTENDANCE_MONTHLY_REPORT)
                .descriptors(propertyDescriptors)
                .build();
    }

    public static ProfileParamProvider profileParamProvider = new AttendanceParamProvider();
}
